/**
 * 系统管理相关类型定义
 * 减少any类型使用，提升类型安全性
 */

import { IBaseResponse, IPaginationParams, IPaginationResponse } from './common';

// 部门相关类型
export interface IDeptFormData {
  id?: string;
  name: string;
  parentId: string;
  orderNum: number;
  leader?: string;
  phone?: string;
  email?: string;
  status: number;
}

export interface IDeptListItem {
  id: string;
  name: string;
  parentId: string;
  parentName?: string;
  orderNum: number;
  leader?: string;
  phone?: string;
  email?: string;
  status: number;
  createTime: string;
  children?: IDeptListItem[];
}

export interface IDeptListParams extends IPaginationParams {
  name?: string;
  parentId?: string;
  status?: number;
}

export interface IDeptListResponse extends IBaseResponse<IPaginationResponse<IDeptListItem>> {}

// 菜单相关类型
export interface IMenuFormData {
  id?: string;
  name: string;
  parentId: string;
  path?: string;
  component?: string;
  type: number;
  icon?: string;
  orderNum: number;
  perms?: string;
  status: number;
}

export interface IMenuListItem {
  id: string;
  name: string;
  parentId: string;
  parentName?: string;
  path?: string;
  component?: string;
  type: number;
  icon?: string;
  orderNum: number;
  perms?: string;
  status: number;
  createTime: string;
  children?: IMenuListItem[];
}

export interface IMenuListParams extends IPaginationParams {
  name?: string;
  parentId?: string;
  type?: number;
  status?: number;
}

export interface IMenuListResponse extends IBaseResponse<IPaginationResponse<IMenuListItem>> {}

// 字典相关类型
export interface IDictTypeFormData {
  id?: string;
  dictName: string;
  dictType: string;
  status: number;
  remark?: string;
}

export interface IDictTypeListItem {
  id: string;
  dictName: string;
  dictType: string;
  status: number;
  remark?: string;
  createTime: string;
}

export interface IDictTypeListParams extends IPaginationParams {
  dictName?: string;
  dictType?: string;
  status?: number;
}

export interface IDictTypeListResponse extends IBaseResponse<IPaginationResponse<IDictTypeListItem>> {}

export interface IDictDataFormData {
  id?: string;
  dictLabel: string;
  dictValue: string;
  dictType: string;
  orderNum: number;
  status: number;
  remark?: string;
}

export interface IDictDataListItem {
  id: string;
  dictLabel: string;
  dictValue: string;
  dictType: string;
  orderNum: number;
  status: number;
  remark?: string;
  createTime: string;
}

export interface IDictDataListParams extends IPaginationParams {
  dictLabel?: string;
  dictType?: string;
  status?: number;
}

export interface IDictDataListResponse extends IBaseResponse<IPaginationResponse<IDictDataListItem>> {}

// 参数配置相关类型
export interface IParamFormData {
  id?: string;
  paramName: string;
  paramKey: string;
  paramValue: string;
  paramType: number;
  status: number;
  remark?: string;
}

export interface IParamListItem {
  id: string;
  paramName: string;
  paramKey: string;
  paramValue: string;
  paramType: number;
  status: number;
  remark?: string;
  createTime: string;
}

export interface IParamListParams extends IPaginationParams {
  paramName?: string;
  paramKey?: string;
  paramType?: number;
  status?: number;
}

export interface IParamListResponse extends IBaseResponse<IPaginationResponse<IParamListItem>> {}

// 日志相关类型
export interface ILogListItem {
  id: string;
  username: string;
  operation: string;
  method: string;
  params: string;
  time: number;
  ip: string;
  createDate: string;
}

export interface ILogListParams extends IPaginationParams {
  username?: string;
  operation?: string;
  startDate?: string;
  endDate?: string;
}

export interface ILogListResponse extends IBaseResponse<IPaginationResponse<ILogListItem>> {}

// 系统监控相关类型
export interface ISystemStatus {
  cpu: {
    usage: number;
    cores: number;
    model: string;
  };
  memory: {
    total: number;
    used: number;
    free: number;
    usage: number;
  };
  disk: {
    total: number;
    used: number;
    free: number;
    usage: number;
  };
  network: {
    rxBytes: number;
    txBytes: number;
    rxPackets: number;
    txPackets: number;
  };
  uptime: number;
  loadAverage: number[];
}

export interface ISystemStatusResponse extends IBaseResponse<ISystemStatus> {}

// 任务调度相关类型
export interface IJobFormData {
  id?: string;
  jobName: string;
  jobGroup: string;
  invokeTarget: string;
  cronExpression: string;
  misfirePolicy: string;
  concurrent: number;
  status: number;
  remark?: string;
}

export interface IJobListItem {
  id: string;
  jobName: string;
  jobGroup: string;
  invokeTarget: string;
  cronExpression: string;
  misfirePolicy: string;
  concurrent: number;
  status: number;
  remark?: string;
  createTime: string;
  nextValidTime?: string;
}

export interface IJobListParams extends IPaginationParams {
  jobName?: string;
  jobGroup?: string;
  status?: number;
}

export interface IJobListResponse extends IBaseResponse<IPaginationResponse<IJobListItem>> {}

// 任务日志相关类型
export interface IJobLogListItem {
  id: string;
  jobName: string;
  jobGroup: string;
  invokeTarget: string;
  jobMessage: string;
  status: number;
  exceptionInfo?: string;
  createTime: string;
}

export interface IJobLogListParams extends IPaginationParams {
  jobName?: string;
  jobGroup?: string;
  status?: number;
  startDate?: string;
  endDate?: string;
}

export interface IJobLogListResponse extends IBaseResponse<IPaginationResponse<IJobLogListItem>> {}
